
   <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="javax.sql.rowset.WebRowSet" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <!--    全局样式-->
    <link rel="stylesheet" href="css/reset.css">
    <!--    字体图标-->
    <link rel="stylesheet" href="css/iconfont.css">
    <!--    主体的样式-->
    <link rel="stylesheet" href="css/container.css">
    <link rel="stylesheet" href="css/footer.css">
</head>
<style type="text/css">
 .container {  
        display: flex;  
        flex-direction: column;  
        justify-content: center;  
        align-items: center;   
        text-align: center;
        padding: 100px;
    }  
	        .table {
                border: 1px solid #cad9ea;
                color: #666;
                margin: auto;
            }

            .table th {
                background-repeat: repeat-x;
                height: 60px;
            }

            .table td,
            .table th {
                border: 1px solid #cad9ea;
                padding: 0 1em 0;
                height: 40px;
            }

            .table tr.alter {
                background-color: #f5fafe;
            }
            .color{
            	background-color: #017E5C;
            	color: white;
            }
</style>
</head>
<body style="text-align: center;margin: auto;">
<div class="nav"> 

 <header class="mui-bar mui-bar-nav color">  
 <h1 class="mui-title color">餐厅【ID: <%= request.getParameter("restaurant_id") %>】点菜界面</h1>  
</header>  

		<div class="container" >
			<h4>正在为您出餐，若您需要加餐请点击下方按钮操作！</h4>
		</div>
<%
String restaurant_id = request.getParameter("id");
//获取酒店名
javax.sql.rowset.WebRowSet rs1 = aa.db.DBTools.getRS("SELECT * FROM restaurants WHERE id="+ restaurant_id);
   if(rs1.next()){
	   restaurant_id = rs1.getString("id");
   
   }
 rs1.close();
%>

<%
String amount = request.getParameter("amount");

%>

<form method="post">
<input type="hidden" name="amount" value="<%=(amount==null? "" : amount) %>"/>

<input type="submit" value="点菜请点我~"/>
<input type="hidden" name="restaurant_id" value="<%=restaurant_id%>"/>
</form>

<%
//如果有日期数据,则通过查询显示房间
if(amount!=null){ %>
<form class="container" method="post" action="Booking">
<table border="1" width="50%">
<tr>
   <th>菜品编号</th>
   <th>菜名</th>
   <th>价格</th>
   <th>数量</th>

</tr>

<%

   javax.sql.rowset.WebRowSet rs = aa.db.DBTools.getRS("SELECT * FROM dishes");
   while(rs.next()){
   %>
 <tr>
  <td><input type="checkbox" name="restaurant_id" value="<%=rs.getString("restaurant_id")%>"/><%=rs.getString("restaurant_id")%></td>

 <td><%=rs.getString("name")%></td>
  <td><%=rs.getString("price")%></td>
   <td><%=rs.getString("stock_quantity")%></td>

 </tr>
 <%
 }
 rs.close();
 %>
 
</table>
<input type="submit" value="加入购物车"/>
<input type="hidden" name="amount" value="<%=amount%>"/>

餐厅id为：<input type="text" name="restaurant_id" value="<%=restaurant_id%>"/>
桌子id为：<input type="text" name="table_id" value="<%=session.getAttribute("table_id")%>"/>
</form>
<% }%>

</body>
</html>